package com.xyy.yueshijia.view.activity;

import android.content.Context;
import android.graphics.Paint;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;
import com.xyy.yueshijia.R;
import com.xyy.yueshijia.bean.shop.StoreGoods;
import com.xyy.yueshijia.utils.ImageLoader;

import java.util.List;

/**
 * Created by lxs on 2017/2/10.
 */

public class SpecialGoodsAdapter extends SuperBaseAdapter<StoreGoods> {
    private Context mContext;

    public SpecialGoodsAdapter(Context context, List<StoreGoods> data) {
        super(context, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, StoreGoods item, int position) {

            holder.setText(R.id.goods_marketprice,item.getGoods_marketprice())
                    .setText(R.id.specila_goods_name,item.getGoods_name())
                    .setText(R.id.special_goods_jingle,item.getGoods_jingle())
                    .setText(R.id.special_goods_price,"￥"+item.getGoods_price())
                    .setText(R.id.special_goods_salenum,"已售 : "+item.getGoods_salenum());
        TextView textView= holder.getView(R.id.goods_marketprice);
        textView.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);


        ImageLoader.getSingleton().displayImage(mContext
                , item.getGoods_image()
                , (ImageView) holder.getView(R.id.special_goods_image));

//        ImageLoader.getSingleton()
//                .displayImage(mContext, mSpecialGoodsList.get(position).getGoods_image()
//                        , holder.specialGoodsImage);
    }

    @Override
    protected int getItemViewLayoutId(int position, StoreGoods item) {
        return R.layout.item_special_listview;
    }
}
